﻿// ------------------------------------------------------------------------------
// <copyright file="AppBarButtonPage.xaml.cs" company="skumaronline.com">
//    Copyright (C) 2012 Suresh Kumar T.  All rights reserved.
// </copyright>
// ------------------------------------------------------------------------------

namespace StoreAppLibDemo.Examples.Controls
{
    using StoreAppLibDemo.Common;
    using Windows.UI.Xaml.Navigation;

    /// <summary>
    /// Page to show app bar button example.
    /// </summary>
    public sealed partial class AppBarButtonPage : LayoutAwarePage
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="AppBarButtonPage"/> class"
        /// </summary>
        public AppBarButtonPage()
        {
            this.InitializeComponent();

            //// Sets page data context
            this.DataContext = new StoreAppLibDemo.ViewModel.AppBarButtonPageView();
        }

        /// <summary>
        /// Handler for MenuItemInvoked event of app bar button. 
        /// </summary>
        /// <param name="sender">The app bar button</param>
        /// <param name="menuItem">The app bar menu tapped</param>
        private void OnAppBarMenuItemInvoked(object sender, StoreAppLib.Controls.MenuItem menuItem)
        {
            (this.DataContext as StoreAppLibDemo.ViewModel.AppBarButtonPageView).SelectedMenuLabel = menuItem.Label;
        }
    }
}
